Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Fix docker image building on macOS #1609

Merged
merged 2 commits into from
Aug 3, 2022
Merged

Fix docker image building on macOS #1609

merged 2 commits into from
Aug 3, 2022

Conversation

krysal
Copy link
Member

@krysal krysal commented Aug 1, 2022

Fixes

Fixes #1608 by @krysal

Description

Adding some extra packages as suggested fixes the image build.

Testing Instructions

  1. Build
docker build . --build-arg RELEASE=v0-test -t openverse-frontend:latest
  1. Run locally to browse the site
docker run --env-file .env -p 8443:8443/tcp openverse-frontend:latest

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • [N/A] I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@krysal krysal requested a review from a team as a code owner August 1, 2022 17:26
@krysal krysal requested review from obulat and dhruvkb August 1, 2022 17:26
@github-actions
Copy link

github-actions bot commented Aug 1, 2022

Storybook and Tailwind configuration previews: Ready

Storybook: https://wordpress.github.io/openverse-frontend/_preview/1609
Tailwind: https://wordpress.github.io/openverse-frontend/_preview/1609/tailwind

Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.

You can check the GitHub pages deployment action list to see the current status of the deployments.

@openverse-bot openverse-bot added 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon 🤖 aspect: dx Concerns developers' experience with the codebase labels Aug 1, 2022
@zackkrida
Copy link
Member

This works locally, but I wonder if we should use the muti-stage approach in the references documentation to keep down the size of the final built images?

https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#node-gyp-alpine

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multistage build works quickly and well locally. I think this is safe to merge and will make local testing much easier. Thanks!

Copy link
Collaborator

@rwidom rwidom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know nothing at all about front end stuff, but I have a mac and saw a call for testing in slack, so I thought I'd give it a shot. Cloned the repo, switched to the branch, ran docker build . --build-arg RELEASE=v0-test -t openverse-frontend:latest and docker did its thing, seemingly successfully. All looking good. But then this:

docker run --env-file .env -p 8443:8443/tcp openverse-frontend:latest
docker: open .env: no such file or directory.
See 'docker run --help'.

TIL how much I appreciate using just in the catalog repo! I looked super quickly in the readme, but didn't see an obvious answer, so I hope it's not a pain for me to just leave this comment here. Happy to try more things or answer questions or whatever if that would help!

@krysal
Copy link
Member Author

krysal commented Aug 3, 2022

@rwidom Thanks for trying this! The .env file comes from instructions in PR #1569, sorry for not mentioning it before, I forgot the TESTING_GUIDELINES.md is updated only there (until the PR gets merged). You can create the file with some variables like this and try again:

# Sample .env file
NODE_ENV=development
DISABLE_SENTRY=true

I agree just commands are very handy for this kind of multi-step tasks 😄 Luckily, we only have to do this here a few times for testing stuff.

@krysal krysal requested a review from rwidom August 3, 2022 03:06
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well on Mac, thank you so much for fixing the Docker build quickly, @krysal !

@krysal krysal merged commit 28a6c43 into main Aug 3, 2022
@krysal krysal deleted the fix/docker_build_macOS branch August 3, 2022 14:01
github-actions bot pushed a commit that referenced this pull request Aug 3, 2022
Copy link
Collaborator

@rwidom rwidom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @krysal ! That sample .env file did the trick.
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't build docker image in macOS
5 participants